package com.example.wisdomclassroomapi.common.exception;

import com.example.wisdomclassroomapi.common.enums.ExceptionInfoEnum;
import lombok.Getter;

/**
 * 应用异常
 */
@Getter
public class ApplicationException extends RuntimeException{
    private String code;

    public ApplicationException() {
        super();
    }

    public ApplicationException(String code, String message) {
        super(message);
        this.code = code;
    }

    public ApplicationException(String code, String message, Throwable th) {
        super(message, th);
        this.code = code;
    }

    public ApplicationException(ExceptionInfoEnum info) {
      this(info.getCode(), info.getMessage());
    }

    public ApplicationException(ExceptionInfoEnum info, Throwable th) {
        this(info.getCode(), info.getMessage(), th);
    }
}
